<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/WEB-INF/view/modules/sys/include/taglib.jsp"%>
<%@ include file="/WEB-INF/view/modules/sys/include/head.jsp"%>
<div class="main-container">
    <div class="padding-md">
        <div class="smart-widget">
            <div class="smart-widget-header">
                修改反馈
                <span class="smart-widget-option">
								<span class="refresh-icon-animated">
									<i class="fa fa-circle-o-notch fa-spin"></i>
								</span>
	                            <a href="#" class="widget-toggle-hidden-option">
	                                <i class="fa fa-cog"></i>
	                            </a>
	                            <a href="#" class="widget-collapse-option" data-toggle="collapse">
	                                <i class="fa fa-chevron-up"></i>
	                            </a>
	                            <a href="#" class="widget-refresh-option">
	                                <i class="fa fa-refresh"></i>
	                            </a>
	                            <a href="#" class="widget-remove-option">
	                                <i class="fa fa-times"></i>
	                            </a>
	                        </span>
            </div>
            <div class="smart-widget-inner">
                <div class="smart-widget-hidden-section">
                    <ul class="widget-color-list clearfix">
                        <li style="background-color:#20232b;" data-color="widget-dark"></li>
                        <li style="background-color:#4c5f70;" data-color="widget-dark-blue"></li>
                        <li style="background-color:#23b7e5;" data-color="widget-blue"></li>
                        <li style="background-color:#2baab1;" data-color="widget-green"></li>
                        <li style="background-color:#edbc6c;" data-color="widget-yellow"></li>
                        <li style="background-color:#fbc852;" data-color="widget-orange"></li>
                        <li style="background-color:#e36159;" data-color="widget-red"></li>
                        <li style="background-color:#7266ba;" data-color="widget-purple"></li>
                        <li style="background-color:#f5f5f5;" data-color="widget-light-grey"></li>
                        <li style="background-color:#fff;" data-color="reset"></li>
                    </ul>
                </div>
                <div class="smart-widget-body">
                    <table class="table table-striped">
                        <thead>
                        <tr>
                            <th>反馈人</th>
                            <th>反馈类型</th>
                            <th>反馈内容</th>
                            <th>反馈人联系电话</th>
                            <th>反馈人联系邮箱</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        <c:forEach items="${feedBackList}" var="feedback">
                            <tr>
                                <td hidden>${feedback.id}</td>
                                <td>${feedback.name}</td>
                                <td><c:if test="${feedback.type eq '0'}">建议</c:if><c:if test="${feedback.type eq '1'}">批评</c:if> </td>
                                <td>${feedback.content}</td>
                                <td>${feedback.phone}</td>
                                <td>${feedback.email}</td>
                                <td><a href="javascript:void(0)"   claass="add-new-event" onclick="update(this)">修改</a>  |  <a href="${ctx}/feedback/remove?id=${feedback.id}" onclick="javascript:return p_del()">删除</a></td>
                            </tr>
                        </c:forEach>
                        </tbody>
                    </table>

                    <div class="modal fade" id="addNewEventModal" aria-hidden="true" style="display: none;">
                        <div class="modal-dialog">
                            <div class="modal-content">
                                <form action="${ctx}/feedback/update" method="post">
                                    <input type="hidden" id="id" name="id" />
                                <div class="modal-header">
                                    <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">×</span><span class="sr-only">Close</span></button>
                                    <h4 class="modal-title" id="myModalLabel">修改反馈信息</h4>
                                </div>
                                <div class="modal-body">
                                    <div class="form-group">
                                        <label class="control-label col-lg-3">反馈类型</label>
                                        <div class="col-lg-9">
                                            <select class="form-control" name="type">
                                                <option value="0" selected>建议</option>
                                                <option value="1">批评</option>
                                            </select>
                                        </div><!-- /.col -->
                                    </div><!-- /form-group -->
                                    <div class="form-group">
                                        <label class="control-label col-lg-3">反馈内容</label>
                                        <div class="col-lg-9">
                                            <!-- 加载编辑器的容器 -->
                                            <script id="container" name="content" type="text/plain"></script>
                                        </div><!-- /.col -->
                                    </div><!-- /form-group -->
                                </div>
                                <div class="modal-footer">
                                    <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                                    <input type="submit" value="修改" class="btn btn-success" />
                                </div>
                                </form>
                            </div>
                        </div>
                    </div>
                    <div style="text-align: center">
                        <ul class="pagination pagination-lg">
                            <li> <%--上一页 hasPreviousPage布尔值是否有上一页，prePage上一页页面--%>
                                <c:if test="${page.hasPreviousPage}">
                                    <a href="${ctx}/feedback/findAll?pageNum=${page.prePage}&pageSize=${page.pageSize}">«</a>
                                </c:if></li>
                            <%--navigatepageNums 集合所有页码  --%>
                            <c:forEach items="${page.navigatepageNums}" var="nav">
                                <c:if test="${nav == page.pageNum}">
                                    <li style="font-weight: bold;"><a href="javascript:;">${nav}</a></li>
                                </c:if>
                                <c:if test="${nav != page.pageNum}">
                                    <li><a href="${ctx}/feedback/findAll?pageNum=${nav}&pageSize=${page.pageSize}">${nav}</a></li>
                                </c:if>
                            </c:forEach>
                            <%--hasNextPage 布尔值判断是否有下一页 nextPage下一页的页码--%>
                            <c:if test="${page.hasNextPage}">
                                <li><a href="${ctx}/feedback/findAll?pageNum=${page.nextPage}&pageSize=${page.pageSize}">»</a></li>
                            </c:if>
                        </ul>
                    </div>
                </div>
            </div><!-- ./smart-widget-inner -->
        </div>
    </div>
</div>
<%@include file="/WEB-INF/view/modules/sys/include/footerlib.jsp"%>
<script>
    //绑定模态框展示的方法
    function update(obj) {
        var tds=$(obj).parent().parent().find('td');
        $('#id').val(tds.eq(0).text());
        var ue = UE.getEditor('container',{toolbars: [
            ['fullscreen', 'source', 'undo', 'redo'],
            ['bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat', 'formatmatch', 'autotypeset', 'blockquote', 'pasteplain', '|', 'forecolor', 'backcolor', 'insertorderedlist', 'insertunorderedlist', 'selectall', 'cleardoc']
        ], autoHeightEnabled: true,
            autoFloatEnabled: true});
        ue.setContent(tds.eq(3).text());
        var txt = ue.getContentTxt();
        $('#addNewEventModal').modal('show');
    }
</script>
<!-- 配置文件 -->
<script type="text/javascript" src="${ctxStatic}/ueditor1_4_3_3-utf8-jsp/utf8-jsp/ueditor.config.js"></script>
<!-- 编辑器源码文件 -->
<script type="text/javascript" src="${ctxStatic}/ueditor1_4_3_3-utf8-jsp/utf8-jsp/ueditor.all.js"></script>
<script>
    $(document).ready(function() {
        $("#type-constraint").validate({
            rules:{
                content :"required"
            },
            messages: {
                content :"请输入发表内容"
            }
        })
    })
</script>
<script>
    function p_del() {
        var msg = "您真的确定要删除吗?";
        if (confirm(msg)==true){
            return true;
        }else{
            return false;
        }
    }
</script>
</body>
</html>
